<?php
declare(strict_types=1);

namespace App\Resource\Activity\LaborDay2023;


use App\Models\MainDB\MallProducts;
use Illuminate\Http\Resources\Json\JsonResource;

class PrizeResource extends JsonResource
{
    public function toArray($request): array
    {
        return [
            "id" => $this->id,
            "prize_id" => $this->prize_id,
            "count" => $this->count,
            "reward_type" => $this->reward_type,
            "reward" => $this->reward_type == MallProducts::RELATION_TYPE ? ProductResource::make($this->prize->reward) : GiftResource::make($this->prize->reward)
        ];
    }
}